#include<stdio.h>
struct stu
{
    char name[20];
    double a;
    double b;
    double c;
    double real;
};
int main()
{
    int n;
    scanf("%d",&n);
    struct stu a1[n];
    for(int i = 0;i<n;i++)
    {
        scanf("%s %lf %lf %lf",a1[i].name,&a1[i].a,&a1[i].b,&a1[i].c);
       a1[i].real = a1[i].a+a1[i].b-a1[i].c;
    }
    for(int i = 0;i<n;i++)
    {
        printf("%s %.2f\n",a1[i].name,a1[i].real);
    }
    return 0;
}

